import { defineStore } from "pinia";
import { ref } from "vue";

export const useOrderStore = defineStore( // 使用导出变量名
  "order",
  () => {
    const order = ref({}); // 状态相关内容

    const setOrder = (neworder) => {
      order.value = neworder; // 更新票据
    };

    const removeOrder = () => {
      order.value = {}; // 移除当前票据
    };

    return { order, setOrder, removeOrder };
  },
  { persist: true }
);
